<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - Lua 5.4.0-alpha - src/llex.c</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - llex.c</td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">Lua 5.4.0-alpha</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">322</td>
            <td class="headerCovTableEntry">327</td>
            <td class="headerCovTableEntryHi">98.5 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2019-06-13 19:44:19</td>
            <td></td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<span class="lineNum">       1 </span>            : /*
<span class="lineNum">       2 </span>            : ** $Id: llex.c $
<span class="lineNum">       3 </span>            : ** Lexical Analyzer
<span class="lineNum">       4 </span>            : ** See Copyright Notice in lua.h
<span class="lineNum">       5 </span>            : */
<span class="lineNum">       6 </span>            : 
<span class="lineNum">       7 </span>            : #define llex_c
<span class="lineNum">       8 </span>            : #define LUA_CORE
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : #include &quot;lprefix.h&quot;
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : 
<span class="lineNum">      13 </span>            : #include &lt;locale.h&gt;
<span class="lineNum">      14 </span>            : #include &lt;string.h&gt;
<span class="lineNum">      15 </span>            : 
<span class="lineNum">      16 </span>            : #include &quot;lua.h&quot;
<span class="lineNum">      17 </span>            : 
<span class="lineNum">      18 </span>            : #include &quot;lctype.h&quot;
<span class="lineNum">      19 </span>            : #include &quot;ldebug.h&quot;
<span class="lineNum">      20 </span>            : #include &quot;ldo.h&quot;
<span class="lineNum">      21 </span>            : #include &quot;lgc.h&quot;
<span class="lineNum">      22 </span>            : #include &quot;llex.h&quot;
<span class="lineNum">      23 </span>            : #include &quot;lobject.h&quot;
<span class="lineNum">      24 </span>            : #include &quot;lparser.h&quot;
<span class="lineNum">      25 </span>            : #include &quot;lstate.h&quot;
<span class="lineNum">      26 </span>            : #include &quot;lstring.h&quot;
<span class="lineNum">      27 </span>            : #include &quot;ltable.h&quot;
<span class="lineNum">      28 </span>            : #include &quot;lzio.h&quot;
<span class="lineNum">      29 </span>            : 
<span class="lineNum">      30 </span>            : 
<span class="lineNum">      31 </span>            : 
<span class="lineNum">      32 </span>            : #define next(ls)        (ls-&gt;current = zgetc(ls-&gt;z))
<span class="lineNum">      33 </span>            : 
<span class="lineNum">      34 </span>            : 
<span class="lineNum">      35 </span>            : 
<span class="lineNum">      36 </span>            : #define currIsNewline(ls)       (ls-&gt;current == '\n' || ls-&gt;current == '\r')
<span class="lineNum">      37 </span>            : 
<span class="lineNum">      38 </span>            : 
<span class="lineNum">      39 </span>            : /* ORDER RESERVED */
<span class="lineNum">      40 </span>            : static const char *const luaX_tokens [] = {
<span class="lineNum">      41 </span>            :     &quot;and&quot;, &quot;break&quot;, &quot;do&quot;, &quot;else&quot;, &quot;elseif&quot;,
<span class="lineNum">      42 </span>            :     &quot;end&quot;, &quot;false&quot;, &quot;for&quot;, &quot;function&quot;, &quot;goto&quot;, &quot;if&quot;,
<span class="lineNum">      43 </span>            :     &quot;in&quot;, &quot;local&quot;, &quot;nil&quot;, &quot;not&quot;, &quot;or&quot;, &quot;repeat&quot;,
<span class="lineNum">      44 </span>            :     &quot;return&quot;, &quot;then&quot;, &quot;true&quot;, &quot;until&quot;, &quot;while&quot;,
<span class="lineNum">      45 </span>            :     &quot;//&quot;, &quot;..&quot;, &quot;...&quot;, &quot;==&quot;, &quot;&gt;=&quot;, &quot;&lt;=&quot;, &quot;~=&quot;,
<span class="lineNum">      46 </span>            :     &quot;&lt;&lt;&quot;, &quot;&gt;&gt;&quot;, &quot;::&quot;, &quot;&lt;eof&gt;&quot;,
<span class="lineNum">      47 </span>            :     &quot;&lt;number&gt;&quot;, &quot;&lt;integer&gt;&quot;, &quot;&lt;name&gt;&quot;, &quot;&lt;string&gt;&quot;
<span class="lineNum">      48 </span>            : };
<span class="lineNum">      49 </span>            : 
<span class="lineNum">      50 </span>            : 
<span class="lineNum">      51 </span>            : #define save_and_next(ls) (save(ls, ls-&gt;current), next(ls))
<span class="lineNum">      52 </span>            : 
<span class="lineNum">      53 </span>            : 
<span class="lineNum">      54 </span>            : static l_noret lexerror (LexState *ls, const char *msg, int token);
<span class="lineNum">      55 </span>            : 
<span class="lineNum">      56 </span>            : 
<span class="lineNum">      57 </span><span class="lineCov">     286574 : static void save (LexState *ls, int c) {</span>
<span class="lineNum">      58 </span><span class="lineCov">     286574 :   Mbuffer *b = ls-&gt;buff;</span>
<span class="lineNum">      59 </span><span class="lineCov">     286574 :   if (luaZ_bufflen(b) + 1 &gt; luaZ_sizebuffer(b)) {</span>
<span class="lineNum">      60 </span>            :     size_t newsize;
<span class="lineNum">      61 </span><span class="lineCov">         76 :     if (luaZ_sizebuffer(b) &gt;= MAX_SIZE/2)</span>
<span class="lineNum">      62 </span><span class="lineNoCov">          0 :       lexerror(ls, &quot;lexical element too long&quot;, 0);</span>
<span class="lineNum">      63 </span><span class="lineCov">         76 :     newsize = luaZ_sizebuffer(b) * 2;</span>
<span class="lineNum">      64 </span><span class="lineCov">         76 :     luaZ_resizebuffer(ls-&gt;L, b, newsize);</span>
<span class="lineNum">      65 </span>            :   }
<span class="lineNum">      66 </span><span class="lineCov">     286574 :   b-&gt;buffer[luaZ_bufflen(b)++] = cast_char(c);</span>
<span class="lineNum">      67 </span><span class="lineCov">     286574 : }</span>
<span class="lineNum">      68 </span>            : 
<span class="lineNum">      69 </span>            : 
<span class="lineNum">      70 </span><span class="lineCov">        108 : void luaX_init (lua_State *L) {</span>
<span class="lineNum">      71 </span>            :   int i;
<span class="lineNum">      72 </span><span class="lineCov">        108 :   TString *e = luaS_newliteral(L, LUA_ENV);  /* create env name */</span>
<span class="lineNum">      73 </span><span class="lineCov">        108 :   luaC_fix(L, obj2gco(e));  /* never collect this name */</span>
<span class="lineNum">      74 </span><span class="lineCov">       2484 :   for (i=0; i&lt;NUM_RESERVED; i++) {</span>
<span class="lineNum">      75 </span><span class="lineCov">       2376 :     TString *ts = luaS_new(L, luaX_tokens[i]);</span>
<span class="lineNum">      76 </span><span class="lineCov">       2376 :     luaC_fix(L, obj2gco(ts));  /* reserved words are never collected */</span>
<span class="lineNum">      77 </span><span class="lineCov">       2376 :     ts-&gt;extra = cast_byte(i+1);  /* reserved word */</span>
<span class="lineNum">      78 </span>            :   }
<span class="lineNum">      79 </span><span class="lineCov">        108 : }</span>
<span class="lineNum">      80 </span>            : 
<span class="lineNum">      81 </span>            : 
<span class="lineNum">      82 </span><span class="lineCov">         35 : const char *luaX_token2str (LexState *ls, int token) {</span>
<span class="lineNum">      83 </span><span class="lineCov">         35 :   if (token &lt; FIRST_RESERVED) {  /* single-byte symbols? */</span>
<span class="lineNum">      84 </span>            :     lua_assert(token == cast_uchar(token));
<span class="lineNum">      85 </span><span class="lineCov">         13 :     if (lisprint(token))</span>
<span class="lineNum">      86 </span><span class="lineCov">         13 :       return luaO_pushfstring(ls-&gt;L, &quot;'%c'&quot;, token);</span>
<span class="lineNum">      87 </span>            :     else  /* control character */
<span class="lineNum">      88 </span><span class="lineNoCov">          0 :       return luaO_pushfstring(ls-&gt;L, &quot;'&lt;\\%d&gt;'&quot;, token);</span>
<span class="lineNum">      89 </span>            :   }
<span class="lineNum">      90 </span>            :   else {
<span class="lineNum">      91 </span><span class="lineCov">         22 :     const char *s = luaX_tokens[token - FIRST_RESERVED];</span>
<span class="lineNum">      92 </span><span class="lineCov">         22 :     if (token &lt; TK_EOS)  /* fixed format (symbols and reserved words)? */</span>
<span class="lineNum">      93 </span><span class="lineCov">         11 :       return luaO_pushfstring(ls-&gt;L, &quot;'%s'&quot;, s);</span>
<span class="lineNum">      94 </span>            :     else  /* names, strings, and numerals */
<span class="lineNum">      95 </span><span class="lineCov">         11 :       return s;</span>
<span class="lineNum">      96 </span>            :   }
<span class="lineNum">      97 </span>            : }
<span class="lineNum">      98 </span>            : 
<span class="lineNum">      99 </span>            : 
<span class="lineNum">     100 </span><span class="lineCov">         37 : static const char *txtToken (LexState *ls, int token) {</span>
<span class="lineNum">     101 </span><span class="lineCov">         37 :   switch (token) {</span>
<span class="lineNum">     102 </span><span class="lineCov">         14 :     case TK_NAME: case TK_STRING:</span>
<span class="lineNum">     103 </span>            :     case TK_FLT: case TK_INT:
<span class="lineNum">     104 </span><span class="lineCov">         14 :       save(ls, '\0');</span>
<span class="lineNum">     105 </span><span class="lineCov">         14 :       return luaO_pushfstring(ls-&gt;L, &quot;'%s'&quot;, luaZ_buffer(ls-&gt;buff));</span>
<span class="lineNum">     106 </span><span class="lineCov">         23 :     default:</span>
<span class="lineNum">     107 </span><span class="lineCov">         23 :       return luaX_token2str(ls, token);</span>
<span class="lineNum">     108 </span>            :   }
<span class="lineNum">     109 </span>            : }
<span class="lineNum">     110 </span>            : 
<span class="lineNum">     111 </span>            : 
<span class="lineNum">     112 </span><span class="lineCov">         44 : static l_noret lexerror (LexState *ls, const char *msg, int token) {</span>
<span class="lineNum">     113 </span><span class="lineCov">         44 :   msg = luaG_addinfo(ls-&gt;L, msg, ls-&gt;source, ls-&gt;linenumber);</span>
<span class="lineNum">     114 </span><span class="lineCov">         44 :   if (token)</span>
<span class="lineNum">     115 </span><span class="lineCov">         37 :     luaO_pushfstring(ls-&gt;L, &quot;%s near %s&quot;, msg, txtToken(ls, token));</span>
<span class="lineNum">     116 </span><span class="lineCov">         44 :   luaD_throw(ls-&gt;L, LUA_ERRSYNTAX);</span>
<span class="lineNum">     117 </span>            : }
<span class="lineNum">     118 </span>            : 
<span class="lineNum">     119 </span>            : 
<span class="lineNum">     120 </span><span class="lineCov">         29 : l_noret luaX_syntaxerror (LexState *ls, const char *msg) {</span>
<span class="lineNum">     121 </span><span class="lineCov">         29 :   lexerror(ls, msg, ls-&gt;t.token);</span>
<span class="lineNum">     122 </span>            : }
<span class="lineNum">     123 </span>            : 
<span class="lineNum">     124 </span>            : 
<span class="lineNum">     125 </span>            : /*
<span class="lineNum">     126 </span>            : ** creates a new string and anchors it in scanner's table so that
<span class="lineNum">     127 </span>            : ** it will not be collected until the end of the compilation
<span class="lineNum">     128 </span>            : ** (by that time it should be anchored somewhere)
<span class="lineNum">     129 </span>            : */
<span class="lineNum">     130 </span><span class="lineCov">      48417 : TString *luaX_newstring (LexState *ls, const char *str, size_t l) {</span>
<span class="lineNum">     131 </span><span class="lineCov">      48417 :   lua_State *L = ls-&gt;L;</span>
<span class="lineNum">     132 </span>            :   TValue *o;  /* entry for 'str' */
<span class="lineNum">     133 </span><span class="lineCov">      48417 :   TString *ts = luaS_newlstr(L, str, l);  /* create new string */</span>
<span class="lineNum">     134 </span><span class="lineCov">      48417 :   setsvalue2s(L, L-&gt;top++, ts);  /* temporarily anchor it in stack */</span>
<span class="lineNum">     135 </span><span class="lineCov">      48417 :   o = luaH_set(L, ls-&gt;h, s2v(L-&gt;top - 1));</span>
<span class="lineNum">     136 </span><span class="lineCov">      48417 :   if (isempty(o)) {  /* not in use yet? */</span>
<span class="lineNum">     137 </span>            :     /* boolean value does not need GC barrier;
<span class="lineNum">     138 </span>            :        table is not a metatable, so it does not need to invalidate cache */
<span class="lineNum">     139 </span><span class="lineCov">      13288 :     setbvalue(o, 1);  /* t[string] = true */</span>
<span class="lineNum">     140 </span><span class="lineCov">      13288 :     luaC_checkGC(L);</span>
<span class="lineNum">     141 </span>            :   }
<span class="lineNum">     142 </span>            :   else {  /* string already present */
<span class="lineNum">     143 </span><span class="lineCov">      35129 :     ts = keystrval(nodefromval(o));  /* re-use value previously stored */</span>
<span class="lineNum">     144 </span>            :   }
<span class="lineNum">     145 </span><span class="lineCov">      48417 :   L-&gt;top--;  /* remove string from stack */</span>
<span class="lineNum">     146 </span><span class="lineCov">      48417 :   return ts;</span>
<span class="lineNum">     147 </span>            : }
<span class="lineNum">     148 </span>            : 
<span class="lineNum">     149 </span>            : 
<span class="lineNum">     150 </span>            : /*
<span class="lineNum">     151 </span>            : ** increment line number and skips newline sequence (any of
<span class="lineNum">     152 </span>            : ** \n, \r, \n\r, or \r\n)
<span class="lineNum">     153 </span>            : */
<span class="lineNum">     154 </span><span class="lineCov">      23519 : static void inclinenumber (LexState *ls) {</span>
<span class="lineNum">     155 </span><span class="lineCov">      23519 :   int old = ls-&gt;current;</span>
<span class="lineNum">     156 </span>            :   lua_assert(currIsNewline(ls));
<span class="lineNum">     157 </span><span class="lineCov">      23519 :   next(ls);  /* skip '\n' or '\r' */</span>
<span class="lineNum">     158 </span><span class="lineCov">      23519 :   if (currIsNewline(ls) &amp;&amp; ls-&gt;current != old)</span>
<span class="lineNum">     159 </span><span class="lineNoCov">          0 :     next(ls);  /* skip '\n\r' or '\r\n' */</span>
<span class="lineNum">     160 </span><span class="lineCov">      23519 :   if (++ls-&gt;linenumber &gt;= MAX_INT)</span>
<span class="lineNum">     161 </span><span class="lineNoCov">          0 :     lexerror(ls, &quot;chunk has too many lines&quot;, 0);</span>
<span class="lineNum">     162 </span><span class="lineCov">      23519 : }</span>
<span class="lineNum">     163 </span>            : 
<span class="lineNum">     164 </span>            : 
<span class="lineNum">     165 </span><span class="lineCov">        513 : void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source,</span>
<span class="lineNum">     166 </span>            :                     int firstchar) {
<span class="lineNum">     167 </span><span class="lineCov">        513 :   ls-&gt;t.token = 0;</span>
<span class="lineNum">     168 </span><span class="lineCov">        513 :   ls-&gt;L = L;</span>
<span class="lineNum">     169 </span><span class="lineCov">        513 :   ls-&gt;current = firstchar;</span>
<span class="lineNum">     170 </span><span class="lineCov">        513 :   ls-&gt;lookahead.token = TK_EOS;  /* no look-ahead token */</span>
<span class="lineNum">     171 </span><span class="lineCov">        513 :   ls-&gt;z = z;</span>
<span class="lineNum">     172 </span><span class="lineCov">        513 :   ls-&gt;fs = NULL;</span>
<span class="lineNum">     173 </span><span class="lineCov">        513 :   ls-&gt;linenumber = 1;</span>
<span class="lineNum">     174 </span><span class="lineCov">        513 :   ls-&gt;lastline = 1;</span>
<span class="lineNum">     175 </span><span class="lineCov">        513 :   ls-&gt;source = source;</span>
<span class="lineNum">     176 </span><span class="lineCov">        513 :   ls-&gt;envn = luaS_newliteral(L, LUA_ENV);  /* get env name */</span>
<span class="lineNum">     177 </span><span class="lineCov">        513 :   luaZ_resizebuffer(ls-&gt;L, ls-&gt;buff, LUA_MINBUFFER);  /* initialize buffer */</span>
<span class="lineNum">     178 </span><span class="lineCov">        513 : }</span>
<span class="lineNum">     179 </span>            : 
<span class="lineNum">     180 </span>            : 
<span class="lineNum">     181 </span>            : 
<span class="lineNum">     182 </span>            : /*
<span class="lineNum">     183 </span>            : ** =======================================================
<span class="lineNum">     184 </span>            : ** LEXICAL ANALYZER
<span class="lineNum">     185 </span>            : ** =======================================================
<span class="lineNum">     186 </span>            : */
<span class="lineNum">     187 </span>            : 
<span class="lineNum">     188 </span>            : 
<span class="lineNum">     189 </span><span class="lineCov">      11292 : static int check_next1 (LexState *ls, int c) {</span>
<span class="lineNum">     190 </span><span class="lineCov">      11292 :   if (ls-&gt;current == c) {</span>
<span class="lineNum">     191 </span><span class="lineCov">       2797 :     next(ls);</span>
<span class="lineNum">     192 </span><span class="lineCov">       2797 :     return 1;</span>
<span class="lineNum">     193 </span>            :   }
<span class="lineNum">     194 </span><span class="lineCov">       8495 :   else return 0;</span>
<span class="lineNum">     195 </span>            : }
<span class="lineNum">     196 </span>            : 
<span class="lineNum">     197 </span>            : 
<span class="lineNum">     198 </span>            : /*
<span class="lineNum">     199 </span>            : ** Check whether current char is in set 'set' (with two chars) and
<span class="lineNum">     200 </span>            : ** saves it
<span class="lineNum">     201 </span>            : */
<span class="lineNum">     202 </span><span class="lineCov">       5653 : static int check_next2 (LexState *ls, const char *set) {</span>
<span class="lineNum">     203 </span>            :   lua_assert(set[2] == '\0');
<span class="lineNum">     204 </span><span class="lineCov">       5653 :   if (ls-&gt;current == set[0] || ls-&gt;current == set[1]) {</span>
<span class="lineNum">     205 </span><span class="lineCov">        108 :     save_and_next(ls);</span>
<span class="lineNum">     206 </span><span class="lineCov">        108 :     return 1;</span>
<span class="lineNum">     207 </span>            :   }
<span class="lineNum">     208 </span><span class="lineCov">       5545 :   else return 0;</span>
<span class="lineNum">     209 </span>            : }
<span class="lineNum">     210 </span>            : 
<span class="lineNum">     211 </span>            : 
<span class="lineNum">     212 </span>            : /* LUA_NUMBER */
<span class="lineNum">     213 </span>            : /*
<span class="lineNum">     214 </span>            : ** this function is quite liberal in what it accepts, as 'luaO_str2num'
<span class="lineNum">     215 </span>            : ** will reject ill-formed numerals.
<span class="lineNum">     216 </span>            : */
<span class="lineNum">     217 </span><span class="lineCov">       3398 : static int read_numeral (LexState *ls, SemInfo *seminfo) {</span>
<span class="lineNum">     218 </span>            :   TValue obj;
<span class="lineNum">     219 </span><span class="lineCov">       3398 :   const char *expo = &quot;Ee&quot;;</span>
<span class="lineNum">     220 </span><span class="lineCov">       3398 :   int first = ls-&gt;current;</span>
<span class="lineNum">     221 </span>            :   lua_assert(lisdigit(ls-&gt;current));
<span class="lineNum">     222 </span><span class="lineCov">       3398 :   save_and_next(ls);</span>
<span class="lineNum">     223 </span><span class="lineCov">       3398 :   if (first == '0' &amp;&amp; check_next2(ls, &quot;xX&quot;))  /* hexadecimal? */</span>
<span class="lineNum">     224 </span><span class="lineCov">         95 :     expo = &quot;Pp&quot;;</span>
<span class="lineNum">     225 </span>            :   for (;;) {
<span class="lineNum">     226 </span><span class="lineCov">       4842 :     if (check_next2(ls, expo))  /* exponent part? */</span>
<span class="lineNum">     227 </span><span class="lineCov">         10 :       check_next2(ls, &quot;-+&quot;);  /* optional exponent sign */</span>
<span class="lineNum">     228 </span><span class="lineCov">       4842 :     if (lisxdigit(ls-&gt;current))</span>
<span class="lineNum">     229 </span><span class="lineCov">       1289 :       save_and_next(ls);</span>
<span class="lineNum">     230 </span><span class="lineCov">       3553 :     else if (ls-&gt;current == '.')</span>
<span class="lineNum">     231 </span><span class="lineCov">        155 :       save_and_next(ls);</span>
<span class="lineNum">     232 </span><span class="lineCov">       3398 :     else break;</span>
<span class="lineNum">     233 </span>            :   }
<span class="lineNum">     234 </span><span class="lineCov">       3398 :   if (lislalnum(ls-&gt;current))  /* is numeral touching an alpha num? */</span>
<span class="lineNum">     235 </span><span class="lineNoCov">          0 :     save_and_next(ls);  /* force an error */</span>
<span class="lineNum">     236 </span><span class="lineCov">       3398 :   save(ls, '\0');</span>
<span class="lineNum">     237 </span><span class="lineCov">       3398 :   if (luaO_str2num(luaZ_buffer(ls-&gt;buff), &amp;obj) == 0)  /* format error? */</span>
<span class="lineNum">     238 </span><span class="lineCov">          1 :     lexerror(ls, &quot;malformed number&quot;, TK_FLT);</span>
<span class="lineNum">     239 </span><span class="lineCov">       3397 :   if (ttisinteger(&amp;obj)) {</span>
<span class="lineNum">     240 </span><span class="lineCov">       3236 :     seminfo-&gt;i = ivalue(&amp;obj);</span>
<span class="lineNum">     241 </span><span class="lineCov">       3236 :     return TK_INT;</span>
<span class="lineNum">     242 </span>            :   }
<span class="lineNum">     243 </span>            :   else {
<span class="lineNum">     244 </span>            :     lua_assert(ttisfloat(&amp;obj));
<span class="lineNum">     245 </span><span class="lineCov">        161 :     seminfo-&gt;r = fltvalue(&amp;obj);</span>
<span class="lineNum">     246 </span><span class="lineCov">        161 :     return TK_FLT;</span>
<span class="lineNum">     247 </span>            :   }
<span class="lineNum">     248 </span>            : }
<span class="lineNum">     249 </span>            : 
<span class="lineNum">     250 </span>            : 
<span class="lineNum">     251 </span>            : /*
<span class="lineNum">     252 </span>            : ** reads a sequence '[=*[' or ']=*]', leaving the last bracket.
<span class="lineNum">     253 </span>            : ** If sequence is well formed, return its number of '='s + 2; otherwise,
<span class="lineNum">     254 </span>            : ** return 1 if there is no '='s or 0 otherwise (an unfinished '[==...').
<span class="lineNum">     255 </span>            : */
<span class="lineNum">     256 </span><span class="lineCov">       1937 : static size_t skip_sep (LexState *ls) {</span>
<span class="lineNum">     257 </span><span class="lineCov">       1937 :   size_t count = 0;</span>
<span class="lineNum">     258 </span><span class="lineCov">       1937 :   int s = ls-&gt;current;</span>
<span class="lineNum">     259 </span>            :   lua_assert(s == '[' || s == ']');
<span class="lineNum">     260 </span><span class="lineCov">       1937 :   save_and_next(ls);</span>
<span class="lineNum">     261 </span><span class="lineCov">       1950 :   while (ls-&gt;current == '=') {</span>
<span class="lineNum">     262 </span><span class="lineCov">         13 :     save_and_next(ls);</span>
<span class="lineNum">     263 </span><span class="lineCov">         13 :     count++;</span>
<span class="lineNum">     264 </span>            :   }
<span class="lineNum">     265 </span><span class="lineCov">       1937 :   return (ls-&gt;current == s) ? count + 2</span>
<span class="lineNum">     266 </span><span class="lineCov">       2600 :          : (count == 0) ? 1</span>
<span class="lineNum">     267 </span><span class="lineCov">        663 :          : 0;</span>
<span class="lineNum">     268 </span>            : }
<span class="lineNum">     269 </span>            : 
<span class="lineNum">     270 </span>            : 
<span class="lineNum">     271 </span><span class="lineCov">        637 : static void read_long_string (LexState *ls, SemInfo *seminfo, size_t sep) {</span>
<span class="lineNum">     272 </span><span class="lineCov">        637 :   int line = ls-&gt;linenumber;  /* initial line (for error message) */</span>
<span class="lineNum">     273 </span><span class="lineCov">        637 :   save_and_next(ls);  /* skip 2nd '[' */</span>
<span class="lineNum">     274 </span><span class="lineCov">        637 :   if (currIsNewline(ls))  /* string starts with a newline? */</span>
<span class="lineNum">     275 </span><span class="lineCov">        268 :     inclinenumber(ls);  /* skip it */</span>
<span class="lineNum">     276 </span>            :   for (;;) {
<span class="lineNum">     277 </span><span class="lineCov">      43980 :     switch (ls-&gt;current) {</span>
<span class="lineNum">     278 </span><span class="lineCov">          2 :       case EOZ: {  /* error */</span>
<span class="lineNum">     279 </span><span class="lineCov">          2 :         const char *what = (seminfo ? &quot;string&quot; : &quot;comment&quot;);</span>
<span class="lineNum">     280 </span><span class="lineCov">          2 :         const char *msg = luaO_pushfstring(ls-&gt;L,</span>
<span class="lineNum">     281 </span>            :                      &quot;unfinished long %s (starting at line %d)&quot;, what, line);
<span class="lineNum">     282 </span><span class="lineCov">          2 :         lexerror(ls, msg, TK_EOS);</span>
<span class="lineNum">     283 </span>            :         break;  /* to avoid warnings */
<span class="lineNum">     284 </span>            :       }
<span class="lineNum">     285 </span><span class="lineCov">        642 :       case ']': {</span>
<span class="lineNum">     286 </span><span class="lineCov">        642 :         if (skip_sep(ls) == sep) {</span>
<span class="lineNum">     287 </span><span class="lineCov">        635 :           save_and_next(ls);  /* skip 2nd ']' */</span>
<span class="lineNum">     288 </span><span class="lineCov">        635 :           goto endloop;</span>
<span class="lineNum">     289 </span>            :         }
<span class="lineNum">     290 </span><span class="lineCov">          7 :         break;</span>
<span class="lineNum">     291 </span>            :       }
<span class="lineNum">     292 </span><span class="lineCov">       1908 :       case '\n': case '\r': {</span>
<span class="lineNum">     293 </span><span class="lineCov">       1908 :         save(ls, '\n');</span>
<span class="lineNum">     294 </span><span class="lineCov">       1908 :         inclinenumber(ls);</span>
<span class="lineNum">     295 </span><span class="lineCov">       1908 :         if (!seminfo) luaZ_resetbuffer(ls-&gt;buff);  /* avoid wasting space */</span>
<span class="lineNum">     296 </span><span class="lineCov">       1908 :         break;</span>
<span class="lineNum">     297 </span>            :       }
<span class="lineNum">     298 </span><span class="lineCov">      41428 :       default: {</span>
<span class="lineNum">     299 </span><span class="lineCov">      41428 :         if (seminfo) save_and_next(ls);</span>
<span class="lineNum">     300 </span><span class="lineCov">      35721 :         else next(ls);</span>
<span class="lineNum">     301 </span>            :       }
<span class="lineNum">     302 </span>            :     }
<span class="lineNum">     303 </span><span class="lineCov">        635 :   } endloop:</span>
<span class="lineNum">     304 </span><span class="lineCov">        635 :   if (seminfo)</span>
<span class="lineNum">     305 </span><span class="lineCov">        151 :     seminfo-&gt;ts = luaX_newstring(ls, luaZ_buffer(ls-&gt;buff) + sep,</span>
<span class="lineNum">     306 </span><span class="lineCov">        151 :                                      luaZ_bufflen(ls-&gt;buff) - 2 * sep);</span>
<span class="lineNum">     307 </span><span class="lineCov">        635 : }</span>
<span class="lineNum">     308 </span>            : 
<span class="lineNum">     309 </span>            : 
<span class="lineNum">     310 </span><span class="lineCov">        581 : static void esccheck (LexState *ls, int c, const char *msg) {</span>
<span class="lineNum">     311 </span><span class="lineCov">        581 :   if (!c) {</span>
<span class="lineNum">     312 </span><span class="lineCov">          6 :     if (ls-&gt;current != EOZ)</span>
<span class="lineNum">     313 </span><span class="lineCov">          6 :       save_and_next(ls);  /* add current to buffer for error message */</span>
<span class="lineNum">     314 </span><span class="lineCov">          6 :     lexerror(ls, msg, TK_STRING);</span>
<span class="lineNum">     315 </span>            :   }
<span class="lineNum">     316 </span><span class="lineCov">        575 : }</span>
<span class="lineNum">     317 </span>            : 
<span class="lineNum">     318 </span>            : 
<span class="lineNum">     319 </span><span class="lineCov">        181 : static int gethexa (LexState *ls) {</span>
<span class="lineNum">     320 </span><span class="lineCov">        181 :   save_and_next(ls);</span>
<span class="lineNum">     321 </span><span class="lineCov">        181 :   esccheck (ls, lisxdigit(ls-&gt;current), &quot;hexadecimal digit expected&quot;);</span>
<span class="lineNum">     322 </span><span class="lineCov">        179 :   return luaO_hexavalue(ls-&gt;current);</span>
<span class="lineNum">     323 </span>            : }
<span class="lineNum">     324 </span>            : 
<span class="lineNum">     325 </span>            : 
<span class="lineNum">     326 </span><span class="lineCov">         63 : static int readhexaesc (LexState *ls) {</span>
<span class="lineNum">     327 </span><span class="lineCov">         63 :   int r = gethexa(ls);</span>
<span class="lineNum">     328 </span><span class="lineCov">         62 :   r = (r &lt;&lt; 4) + gethexa(ls);</span>
<span class="lineNum">     329 </span><span class="lineCov">         62 :   luaZ_buffremove(ls-&gt;buff, 2);  /* remove saved chars from buffer */</span>
<span class="lineNum">     330 </span><span class="lineCov">         62 :   return r;</span>
<span class="lineNum">     331 </span>            : }
<span class="lineNum">     332 </span>            : 
<span class="lineNum">     333 </span>            : 
<span class="lineNum">     334 </span><span class="lineCov">         56 : static unsigned long readutf8esc (LexState *ls) {</span>
<span class="lineNum">     335 </span>            :   unsigned long r;
<span class="lineNum">     336 </span><span class="lineCov">         56 :   int i = 4;  /* chars to be removed: '\', 'u', '{', and first digit */</span>
<span class="lineNum">     337 </span><span class="lineCov">         56 :   save_and_next(ls);  /* skip 'u' */</span>
<span class="lineNum">     338 </span><span class="lineCov">         56 :   esccheck(ls, ls-&gt;current == '{', &quot;missing '{'&quot;);</span>
<span class="lineNum">     339 </span><span class="lineCov">         56 :   r = gethexa(ls);  /* must have at least one digit */</span>
<span class="lineNum">     340 </span><span class="lineCov">        213 :   while (cast_void(save_and_next(ls)), lisxdigit(ls-&gt;current)) {</span>
<span class="lineNum">     341 </span><span class="lineCov">        159 :     i++;</span>
<span class="lineNum">     342 </span><span class="lineCov">        159 :     esccheck(ls, r &lt;= (0x7FFFFFFFu &gt;&gt; 4), &quot;UTF-8 value too large&quot;);</span>
<span class="lineNum">     343 </span><span class="lineCov">        158 :     r = (r &lt;&lt; 4) + luaO_hexavalue(ls-&gt;current);</span>
<span class="lineNum">     344 </span>            :   }
<span class="lineNum">     345 </span><span class="lineCov">         54 :   esccheck(ls, ls-&gt;current == '}', &quot;missing '}'&quot;);</span>
<span class="lineNum">     346 </span><span class="lineCov">         53 :   next(ls);  /* skip '}' */</span>
<span class="lineNum">     347 </span><span class="lineCov">         53 :   luaZ_buffremove(ls-&gt;buff, i);  /* remove saved chars from buffer */</span>
<span class="lineNum">     348 </span><span class="lineCov">         53 :   return r;</span>
<span class="lineNum">     349 </span>            : }
<span class="lineNum">     350 </span>            : 
<span class="lineNum">     351 </span>            : 
<span class="lineNum">     352 </span><span class="lineCov">         56 : static void utf8esc (LexState *ls) {</span>
<span class="lineNum">     353 </span>            :   char buff[UTF8BUFFSZ];
<span class="lineNum">     354 </span><span class="lineCov">         56 :   int n = luaO_utf8esc(buff, readutf8esc(ls));</span>
<span class="lineNum">     355 </span><span class="lineCov">        204 :   for (; n &gt; 0; n--)  /* add 'buff' to string */</span>
<span class="lineNum">     356 </span><span class="lineCov">        151 :     save(ls, buff[UTF8BUFFSZ - n]);</span>
<span class="lineNum">     357 </span><span class="lineCov">         53 : }</span>
<span class="lineNum">     358 </span>            : 
<span class="lineNum">     359 </span>            : 
<span class="lineNum">     360 </span><span class="lineCov">         65 : static int readdecesc (LexState *ls) {</span>
<span class="lineNum">     361 </span>            :   int i;
<span class="lineNum">     362 </span><span class="lineCov">         65 :   int r = 0;  /* result accumulator */</span>
<span class="lineNum">     363 </span><span class="lineCov">        172 :   for (i = 0; i &lt; 3 &amp;&amp; lisdigit(ls-&gt;current); i++) {  /* read up to 3 digits */</span>
<span class="lineNum">     364 </span><span class="lineCov">        107 :     r = 10*r + ls-&gt;current - '0';</span>
<span class="lineNum">     365 </span><span class="lineCov">        107 :     save_and_next(ls);</span>
<span class="lineNum">     366 </span>            :   }
<span class="lineNum">     367 </span><span class="lineCov">         65 :   esccheck(ls, r &lt;= UCHAR_MAX, &quot;decimal escape too large&quot;);</span>
<span class="lineNum">     368 </span><span class="lineCov">         64 :   luaZ_buffremove(ls-&gt;buff, i);  /* remove read digits from buffer */</span>
<span class="lineNum">     369 </span><span class="lineCov">         64 :   return r;</span>
<span class="lineNum">     370 </span>            : }
<span class="lineNum">     371 </span>            : 
<span class="lineNum">     372 </span>            : 
<span class="lineNum">     373 </span><span class="lineCov">       6893 : static void read_string (LexState *ls, int del, SemInfo *seminfo) {</span>
<span class="lineNum">     374 </span><span class="lineCov">       6893 :   save_and_next(ls);  /* keep delimiter (for error messages) */</span>
<span class="lineNum">     375 </span><span class="lineCov">      83169 :   while (ls-&gt;current != del) {</span>
<span class="lineNum">     376 </span><span class="lineCov">      76287 :     switch (ls-&gt;current) {</span>
<span class="lineNum">     377 </span><span class="lineCov">          3 :       case EOZ:</span>
<span class="lineNum">     378 </span><span class="lineCov">          3 :         lexerror(ls, &quot;unfinished string&quot;, TK_EOS);</span>
<span class="lineNum">     379 </span>            :         break;  /* to avoid warnings */
<span class="lineNum">     380 </span><span class="lineCov">          2 :       case '\n':</span>
<span class="lineNum">     381 </span>            :       case '\r':
<span class="lineNum">     382 </span><span class="lineCov">          2 :         lexerror(ls, &quot;unfinished string&quot;, TK_STRING);</span>
<span class="lineNum">     383 </span>            :         break;  /* to avoid warnings */
<span class="lineNum">     384 </span><span class="lineCov">        507 :       case '\\': {  /* escape sequences */</span>
<span class="lineNum">     385 </span>            :         int c;  /* final character to be saved */
<span class="lineNum">     386 </span><span class="lineCov">        507 :         save_and_next(ls);  /* keep '\\' for error messages */</span>
<span class="lineNum">     387 </span><span class="lineCov">        507 :         switch (ls-&gt;current) {</span>
<span class="lineNum">     388 </span><span class="lineCov">          2 :           case 'a': c = '\a'; goto read_save;</span>
<span class="lineNum">     389 </span><span class="lineCov">          8 :           case 'b': c = '\b'; goto read_save;</span>
<span class="lineNum">     390 </span><span class="lineCov">         12 :           case 'f': c = '\f'; goto read_save;</span>
<span class="lineNum">     391 </span><span class="lineCov">         59 :           case 'n': c = '\n'; goto read_save;</span>
<span class="lineNum">     392 </span><span class="lineCov">         17 :           case 'r': c = '\r'; goto read_save;</span>
<span class="lineNum">     393 </span><span class="lineCov">        182 :           case 't': c = '\t'; goto read_save;</span>
<span class="lineNum">     394 </span><span class="lineCov">          2 :           case 'v': c = '\v'; goto read_save;</span>
<span class="lineNum">     395 </span><span class="lineCov">         63 :           case 'x': c = readhexaesc(ls); goto read_save;</span>
<span class="lineNum">     396 </span><span class="lineCov">         56 :           case 'u': utf8esc(ls);  goto no_save;</span>
<span class="lineNum">     397 </span><span class="lineCov">          1 :           case '\n': case '\r':</span>
<span class="lineNum">     398 </span><span class="lineCov">          1 :             inclinenumber(ls); c = '\n'; goto only_save;</span>
<span class="lineNum">     399 </span><span class="lineCov">         36 :           case '\\': case '\&quot;': case '\'':</span>
<span class="lineNum">     400 </span><span class="lineCov">         36 :             c = ls-&gt;current; goto read_save;</span>
<span class="lineNum">     401 </span><span class="lineCov">          1 :           case EOZ: goto no_save;  /* will raise an error next loop */</span>
<span class="lineNum">     402 </span><span class="lineCov">          2 :           case 'z': {  /* zap following span of spaces */</span>
<span class="lineNum">     403 </span><span class="lineCov">          2 :             luaZ_buffremove(ls-&gt;buff, 1);  /* remove '\\' */</span>
<span class="lineNum">     404 </span><span class="lineCov">          2 :             next(ls);  /* skip the 'z' */</span>
<span class="lineNum">     405 </span><span class="lineCov">          8 :             while (lisspace(ls-&gt;current)) {</span>
<span class="lineNum">     406 </span><span class="lineCov">          6 :               if (currIsNewline(ls)) inclinenumber(ls);</span>
<span class="lineNum">     407 </span><span class="lineCov">          5 :               else next(ls);</span>
<span class="lineNum">     408 </span>            :             }
<span class="lineNum">     409 </span><span class="lineCov">          2 :             goto no_save;</span>
<span class="lineNum">     410 </span>            :           }
<span class="lineNum">     411 </span><span class="lineCov">         66 :           default: {</span>
<span class="lineNum">     412 </span><span class="lineCov">         66 :             esccheck(ls, lisdigit(ls-&gt;current), &quot;invalid escape sequence&quot;);</span>
<span class="lineNum">     413 </span><span class="lineCov">         65 :             c = readdecesc(ls);  /* digital escape '\ddd' */</span>
<span class="lineNum">     414 </span><span class="lineCov">         64 :             goto only_save;</span>
<span class="lineNum">     415 </span>            :           }
<span class="lineNum">     416 </span>            :         }
<span class="lineNum">     417 </span><span class="lineCov">        380 :        read_save:</span>
<span class="lineNum">     418 </span><span class="lineCov">        380 :          next(ls);</span>
<span class="lineNum">     419 </span>            :          /* go through */
<span class="lineNum">     420 </span><span class="lineCov">        445 :        only_save:</span>
<span class="lineNum">     421 </span><span class="lineCov">        445 :          luaZ_buffremove(ls-&gt;buff, 1);  /* remove '\\' */</span>
<span class="lineNum">     422 </span><span class="lineCov">        445 :          save(ls, c);</span>
<span class="lineNum">     423 </span>            :          /* go through */
<span class="lineNum">     424 </span><span class="lineCov">        501 :        no_save: break;</span>
<span class="lineNum">     425 </span>            :       }
<span class="lineNum">     426 </span><span class="lineCov">      75775 :       default:</span>
<span class="lineNum">     427 </span><span class="lineCov">      75775 :         save_and_next(ls);</span>
<span class="lineNum">     428 </span>            :     }
<span class="lineNum">     429 </span>            :   }
<span class="lineNum">     430 </span><span class="lineCov">       6882 :   save_and_next(ls);  /* skip delimiter */</span>
<span class="lineNum">     431 </span><span class="lineCov">      13764 :   seminfo-&gt;ts = luaX_newstring(ls, luaZ_buffer(ls-&gt;buff) + 1,</span>
<span class="lineNum">     432 </span><span class="lineCov">       6882 :                                    luaZ_bufflen(ls-&gt;buff) - 2);</span>
<span class="lineNum">     433 </span><span class="lineCov">       6882 : }</span>
<span class="lineNum">     434 </span>            : 
<span class="lineNum">     435 </span>            : 
<span class="lineNum">     436 </span><span class="lineCov">      91140 : static int llex (LexState *ls, SemInfo *seminfo) {</span>
<span class="lineNum">     437 </span><span class="lineCov">      91140 :   luaZ_resetbuffer(ls-&gt;buff);</span>
<span class="lineNum">     438 </span>            :   for (;;) {
<span class="lineNum">     439 </span><span class="lineCov">     245015 :     switch (ls-&gt;current) {</span>
<span class="lineNum">     440 </span><span class="lineCov">      21341 :       case '\n': case '\r': {  /* line breaks */</span>
<span class="lineNum">     441 </span><span class="lineCov">      21341 :         inclinenumber(ls);</span>
<span class="lineNum">     442 </span><span class="lineCov">      21341 :         break;</span>
<span class="lineNum">     443 </span>            :       }
<span class="lineNum">     444 </span><span class="lineCov">     129966 :       case ' ': case '\f': case '\t': case '\v': {  /* spaces */</span>
<span class="lineNum">     445 </span><span class="lineCov">     129966 :         next(ls);</span>
<span class="lineNum">     446 </span><span class="lineCov">     129966 :         break;</span>
<span class="lineNum">     447 </span>            :       }
<span class="lineNum">     448 </span><span class="lineCov">       2886 :       case '-': {  /* '-' or '--' (comment) */</span>
<span class="lineNum">     449 </span><span class="lineCov">       2886 :         next(ls);</span>
<span class="lineNum">     450 </span><span class="lineCov">       2886 :         if (ls-&gt;current != '-') return '-';</span>
<span class="lineNum">     451 </span>            :         /* else is a comment */
<span class="lineNum">     452 </span><span class="lineCov">       2569 :         next(ls);</span>
<span class="lineNum">     453 </span><span class="lineCov">       2569 :         if (ls-&gt;current == '[') {  /* long comment? */</span>
<span class="lineNum">     454 </span><span class="lineCov">        485 :           size_t sep = skip_sep(ls);</span>
<span class="lineNum">     455 </span><span class="lineCov">        485 :           luaZ_resetbuffer(ls-&gt;buff);  /* 'skip_sep' may dirty the buffer */</span>
<span class="lineNum">     456 </span><span class="lineCov">        485 :           if (sep &gt;= 2) {</span>
<span class="lineNum">     457 </span><span class="lineCov">        485 :             read_long_string(ls, NULL, sep);  /* skip long comment */</span>
<span class="lineNum">     458 </span><span class="lineCov">        484 :             luaZ_resetbuffer(ls-&gt;buff);  /* previous call may dirty the buff. */</span>
<span class="lineNum">     459 </span><span class="lineCov">        484 :             break;</span>
<span class="lineNum">     460 </span>            :           }
<span class="lineNum">     461 </span>            :         }
<span class="lineNum">     462 </span>            :         /* else short comment */
<span class="lineNum">     463 </span><span class="lineCov">      41521 :         while (!currIsNewline(ls) &amp;&amp; ls-&gt;current != EOZ)</span>
<span class="lineNum">     464 </span><span class="lineCov">      39437 :           next(ls);  /* skip until end of line (or end of file) */</span>
<span class="lineNum">     465 </span><span class="lineCov">       2084 :         break;</span>
<span class="lineNum">     466 </span>            :       }
<span class="lineNum">     467 </span><span class="lineCov">        810 :       case '[': {  /* long string or simply '[' */</span>
<span class="lineNum">     468 </span><span class="lineCov">        810 :         size_t sep = skip_sep(ls);</span>
<span class="lineNum">     469 </span><span class="lineCov">        810 :         if (sep &gt;= 2) {</span>
<span class="lineNum">     470 </span><span class="lineCov">        152 :           read_long_string(ls, seminfo, sep);</span>
<span class="lineNum">     471 </span><span class="lineCov">        151 :           return TK_STRING;</span>
<span class="lineNum">     472 </span>            :         }
<span class="lineNum">     473 </span><span class="lineCov">        658 :         else if (sep == 0)  /* '[=...' missing second bracket? */</span>
<span class="lineNum">     474 </span><span class="lineCov">          1 :           lexerror(ls, &quot;invalid long string delimiter&quot;, TK_STRING);</span>
<span class="lineNum">     475 </span><span class="lineCov">        657 :         return '[';</span>
<span class="lineNum">     476 </span>            :       }
<span class="lineNum">     477 </span><span class="lineCov">       4218 :       case '=': {</span>
<span class="lineNum">     478 </span><span class="lineCov">       4218 :         next(ls);</span>
<span class="lineNum">     479 </span><span class="lineCov">       4218 :         if (check_next1(ls, '=')) return TK_EQ;</span>
<span class="lineNum">     480 </span><span class="lineCov">       3825 :         else return '=';</span>
<span class="lineNum">     481 </span>            :       }
<span class="lineNum">     482 </span><span class="lineCov">        108 :       case '&lt;': {</span>
<span class="lineNum">     483 </span><span class="lineCov">        108 :         next(ls);</span>
<span class="lineNum">     484 </span><span class="lineCov">        108 :         if (check_next1(ls, '=')) return TK_LE;</span>
<span class="lineNum">     485 </span><span class="lineCov">         69 :         else if (check_next1(ls, '&lt;')) return TK_SHL;</span>
<span class="lineNum">     486 </span><span class="lineCov">         49 :         else return '&lt;';</span>
<span class="lineNum">     487 </span>            :       }
<span class="lineNum">     488 </span><span class="lineCov">        203 :       case '&gt;': {</span>
<span class="lineNum">     489 </span><span class="lineCov">        203 :         next(ls);</span>
<span class="lineNum">     490 </span><span class="lineCov">        203 :         if (check_next1(ls, '=')) return TK_GE;</span>
<span class="lineNum">     491 </span><span class="lineCov">         61 :         else if (check_next1(ls, '&gt;')) return TK_SHR;</span>
<span class="lineNum">     492 </span><span class="lineCov">         41 :         else return '&gt;';</span>
<span class="lineNum">     493 </span>            :       }
<span class="lineNum">     494 </span><span class="lineCov">         68 :       case '/': {</span>
<span class="lineNum">     495 </span><span class="lineCov">         68 :         next(ls);</span>
<span class="lineNum">     496 </span><span class="lineCov">         68 :         if (check_next1(ls, '/')) return TK_IDIV;</span>
<span class="lineNum">     497 </span><span class="lineCov">         39 :         else return '/';</span>
<span class="lineNum">     498 </span>            :       }
<span class="lineNum">     499 </span><span class="lineCov">        269 :       case '~': {</span>
<span class="lineNum">     500 </span><span class="lineCov">        269 :         next(ls);</span>
<span class="lineNum">     501 </span><span class="lineCov">        269 :         if (check_next1(ls, '=')) return TK_NE;</span>
<span class="lineNum">     502 </span><span class="lineCov">         32 :         else return '~';</span>
<span class="lineNum">     503 </span>            :       }
<span class="lineNum">     504 </span><span class="lineCov">        491 :       case ':': {</span>
<span class="lineNum">     505 </span><span class="lineCov">        491 :         next(ls);</span>
<span class="lineNum">     506 </span><span class="lineCov">        491 :         if (check_next1(ls, ':')) return TK_DBCOLON;</span>
<span class="lineNum">     507 </span><span class="lineCov">        475 :         else return ':';</span>
<span class="lineNum">     508 </span>            :       }
<span class="lineNum">     509 </span><span class="lineCov">       6893 :       case '&quot;': case '\'': {  /* short literal strings */</span>
<span class="lineNum">     510 </span><span class="lineCov">       6893 :         read_string(ls, ls-&gt;current, seminfo);</span>
<span class="lineNum">     511 </span><span class="lineCov">       6882 :         return TK_STRING;</span>
<span class="lineNum">     512 </span>            :       }
<span class="lineNum">     513 </span><span class="lineCov">       3941 :       case '.': {  /* '.', '..', '...', or number */</span>
<span class="lineNum">     514 </span><span class="lineCov">       3941 :         save_and_next(ls);</span>
<span class="lineNum">     515 </span><span class="lineCov">       3941 :         if (check_next1(ls, '.')) {</span>
<span class="lineNum">     516 </span><span class="lineCov">       1864 :           if (check_next1(ls, '.'))</span>
<span class="lineNum">     517 </span><span class="lineCov">         37 :             return TK_DOTS;   /* '...' */</span>
<span class="lineNum">     518 </span><span class="lineCov">       1827 :           else return TK_CONCAT;   /* '..' */</span>
<span class="lineNum">     519 </span>            :         }
<span class="lineNum">     520 </span><span class="lineCov">       2077 :         else if (!lisdigit(ls-&gt;current)) return '.';</span>
<span class="lineNum">     521 </span><span class="lineCov">          1 :         else return read_numeral(ls, seminfo);</span>
<span class="lineNum">     522 </span>            :       }
<span class="lineNum">     523 </span><span class="lineCov">       3397 :       case '0': case '1': case '2': case '3': case '4':</span>
<span class="lineNum">     524 </span>            :       case '5': case '6': case '7': case '8': case '9': {
<span class="lineNum">     525 </span><span class="lineCov">       3397 :         return read_numeral(ls, seminfo);</span>
<span class="lineNum">     526 </span>            :       }
<span class="lineNum">     527 </span><span class="lineCov">        479 :       case EOZ: {</span>
<span class="lineNum">     528 </span><span class="lineCov">        479 :         return TK_EOS;</span>
<span class="lineNum">     529 </span>            :       }
<span class="lineNum">     530 </span><span class="lineCov">      69945 :       default: {</span>
<span class="lineNum">     531 </span><span class="lineCov">      69945 :         if (lislalpha(ls-&gt;current)) {  /* identifier or reserved word? */</span>
<span class="lineNum">     532 </span>            :           TString *ts;
<span class="lineNum">     533 </span>            :           do {
<span class="lineNum">     534 </span><span class="lineCov">     172218 :             save_and_next(ls);</span>
<span class="lineNum">     535 </span><span class="lineCov">     172218 :           } while (lislalnum(ls-&gt;current));</span>
<span class="lineNum">     536 </span><span class="lineCov">      40355 :           ts = luaX_newstring(ls, luaZ_buffer(ls-&gt;buff),</span>
<span class="lineNum">     537 </span><span class="lineCov">      40355 :                                   luaZ_bufflen(ls-&gt;buff));</span>
<span class="lineNum">     538 </span><span class="lineCov">      40355 :           seminfo-&gt;ts = ts;</span>
<span class="lineNum">     539 </span><span class="lineCov">      40355 :           if (isreserved(ts))  /* reserved word? */</span>
<span class="lineNum">     540 </span><span class="lineCov">      13747 :             return ts-&gt;extra - 1 + FIRST_RESERVED;</span>
<span class="lineNum">     541 </span>            :           else {
<span class="lineNum">     542 </span><span class="lineCov">      26608 :             return TK_NAME;</span>
<span class="lineNum">     543 </span>            :           }
<span class="lineNum">     544 </span>            :         }
<span class="lineNum">     545 </span>            :         else {  /* single-char tokens (+ - / ...) */
<span class="lineNum">     546 </span><span class="lineCov">      29590 :           int c = ls-&gt;current;</span>
<span class="lineNum">     547 </span><span class="lineCov">      29590 :           next(ls);</span>
<span class="lineNum">     548 </span><span class="lineCov">      29590 :           return c;</span>
<span class="lineNum">     549 </span>            :         }
<span class="lineNum">     550 </span>            :       }
<span class="lineNum">     551 </span>            :     }
<span class="lineNum">     552 </span>            :   }
<span class="lineNum">     553 </span>            : }
<span class="lineNum">     554 </span>            : 
<span class="lineNum">     555 </span>            : 
<span class="lineNum">     556 </span><span class="lineCov">      91140 : void luaX_next (LexState *ls) {</span>
<span class="lineNum">     557 </span><span class="lineCov">      91140 :   ls-&gt;lastline = ls-&gt;linenumber;</span>
<span class="lineNum">     558 </span><span class="lineCov">      91140 :   if (ls-&gt;lookahead.token != TK_EOS) {  /* is there a look-ahead token? */</span>
<span class="lineNum">     559 </span><span class="lineCov">        497 :     ls-&gt;t = ls-&gt;lookahead;  /* use this one */</span>
<span class="lineNum">     560 </span><span class="lineCov">        497 :     ls-&gt;lookahead.token = TK_EOS;  /* and discharge it */</span>
<span class="lineNum">     561 </span>            :   }
<span class="lineNum">     562 </span>            :   else
<span class="lineNum">     563 </span><span class="lineCov">      90643 :     ls-&gt;t.token = llex(ls, &amp;ls-&gt;t.seminfo);  /* read next token */</span>
<span class="lineNum">     564 </span><span class="lineCov">      91125 : }</span>
<span class="lineNum">     565 </span>            : 
<span class="lineNum">     566 </span>            : 
<span class="lineNum">     567 </span><span class="lineCov">        497 : int luaX_lookahead (LexState *ls) {</span>
<span class="lineNum">     568 </span>            :   lua_assert(ls-&gt;lookahead.token == TK_EOS);
<span class="lineNum">     569 </span><span class="lineCov">        497 :   ls-&gt;lookahead.token = llex(ls, &amp;ls-&gt;lookahead.seminfo);</span>
<span class="lineNum">     570 </span><span class="lineCov">        497 :   return ls-&gt;lookahead.token;</span>
<span class="lineNum">     571 </span>            : }
<span class="lineNum">     572 </span>            : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.13</a></td></tr>
  </table>
  <br>

</body>
</html>
